import java.util.Scanner;

public class SubwayDemo01 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入公里数");
        float distance = scanner.nextFloat();//80.0


        float money = 0f;//每次的钱
        float allMoney = 0f;// 装所有的钱
        if (distance > 0) {// 先判断距离是否合法
            for (int i = 1; i < 61; i++) {// 循环60次
                if (distance <= 6) {
                    money = 3;
                } else if (distance <= 12) {
                    money = 4;
                } else if (distance <= 22) {
                    money = 5;
                } else if (distance <= 32) {
                    money = 6;
                } else {
                    if ((distance - 32) % 20 == 0) {
                        money = 6 + (distance - 32) / 20;
                    } else {
                        money = 6 + (int) ((distance - 32) / 20 + 1);// 好好理解
                    }

                }
                // 打折的逻辑
                if (allMoney >= 100 && allMoney < 150) {
                    allMoney += money * 0.8;
                } else if (allMoney>=150 && allMoney < 400) {
                    allMoney += money * 0.5;
                } else {
                    allMoney += money;
                }

            }
            System.out.println(String.format("%.2f",allMoney));

        } else {
            System.out.println("非法距离");
        }

    }
}
